package com.neuedu.elmserver.controller;

import com.neuedu.elmserver.pojo.FeaturedFoods;
import com.neuedu.elmserver.service.FeaturedFoodsService;
import com.neuedu.elmserver.service.RecipesService;
import com.neuedu.elmserver.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/api/featuredfoods")
@CrossOrigin
public class FeaturedFoodsController {

   /* private final FeaturedFoodsService featuredFoodsService;

    @Autowired
    public FeaturedFoodsController(FeaturedFoodsService featuredFoodsService) {
        this.featuredFoodsService = featuredFoodsService;
    }

    // 处理前端获取特色美食列表的请求接口
    @GetMapping
    public ResponseEntity<ResultVO<List<FeaturedFoods>>> getFeaturedFoodsList() {
        ResultVO<List<FeaturedFoods>> result = featuredFoodsService.getFeaturedFoodsList();
        if (result.getCode() == 200) {
            return new ResponseEntity<>(result, HttpStatus.OK);
        }
        return new ResponseEntity<>(result, HttpStatus.NO_CONTENT);
    }*/
   @Autowired
   private FeaturedFoodsService featuredFoodsService;


    @GetMapping()
    public ResultVO queryFeaturedFoodsList(){

        return featuredFoodsService.queryFeaturedFoodsList();
    }
}